package com.mylogistics.common.service.impl;

import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * 缓存服务类
 */
@Service
public class CodeCacheService {
    //在cacheTest缓存中缓存对象
    @CachePut(value = "cacheTest", key = "#principal")
    public Object saveCode(Object principal,Object code){
        return code;
    }
    //从cacheTest取出对象
    @Cacheable(value = "cacheTest", key = "#principal")
    public Object getCode(Object principal){
        return null;
    }

    //在cacheTest删除对象
    @CacheEvict(value = "cacheTest", key = "#principal")
    public void deleteCode(Object principal){

    }

}

